<?php
namespace app\main\controller;

use system\core\Controller;

class BaseController extends Controller 
{
    protected function initialize()
    {
        // 子类可以重写此方法

        // 设置layout路径
        $this->assign('title', 'tinyerp');
        $this->setLayout(APP_PATH . "main/view/layout.phtml");
        // $this->checkLogin();
    }

    protected function checkLogin() 
    {
        // TODO: 登录验证逻辑
        if(!isset($_SESSION['user_id'])) {
            header('Location: /main/user/login');
            exit;
        }
    }

    protected function checkPermission($permission) 
    {
        // TODO: 权限验证逻辑
    }
}
